<?php
class RequestsModel extends BaseModel implements Model {
    function __construct() {
        parent::__construct("request", "request_id");
        $this->addField("request_id", Model::TYPE_INT, Model::MOD_PRIMARY);
        $this->addField("type", Model::TYPE_VARCHAR);
        $this->addField("requestname", Model::TYPE_VARCHAR);
        $this->addField("user_id", Model::TYPE_INT);
        $this->addField("quantity", Model::TYPE_INT);
        $this->addField("unit", Model::TYPE_VARCHAR);
        $this->addField("request_date", Model::TYPE_DATE_ADDITION);
    }

    public function renderAlias($record) {
        $result = $record;
        return $result;
    }

    public function isAuthorized($operation, $subject = "") {
        return true;
//        if (Auth::isAdmin()) { return true; }
/*
        switch ($operation) {
            case "update" :
            case "delete" :
            case "addnew" : {
                if (Auth::canChangeDrivers()) { return true; }
            }
            case "list" : {
                if (Auth::canListDrivers()) { return true; }
            }
        }
        return false;
*/
    }

    public function modifyDatabaseInput($data) {
        return $data;
    }
}

?>
